package com.fis.hthk.dblinkapi.util;




import com.ssaglobal.SsaException;
import com.ssaglobal.scm.wms.service.exeprocessmanager.TransactionServiceSORemote;
import com.ssaglobal.scm.wms.service.exeprocessmanager.TransactionServiceSORemoteHome;
import com.ssaglobal.util.EjbHelper;




public class EJBRemote {
	
	public static TransactionServiceSORemote getRemote(String provider) throws SsaException {
		try {
			System.out.println("In side the getRemote");

			/*Enterprise ent = SsaAccessBase.getEnterprise("webUI", "TransactionServiceSORemote");
			String provider = ent.getProvider();
			String factory = ent.getFactory();
			String jndiName = ent.getJndiName();*/
			//String provider = "188.100.108.240:6840";
			String factory = "org.jnp.interfaces.NamingContextFactory";
			String jndiName = "TransactionServiceSORemote";
System.out.println("@@@@@@@provider="+provider);		
System.out.println("@@@@@@@factory="+factory);		
System.out.println("@@@@@@@jndiName="+jndiName);		
			return (TransactionServiceSORemote) EjbHelper.getSession(provider, null, null,factory, 
					jndiName, TransactionServiceSORemoteHome.class);

			 

			
			
/*			WebuiConfig webConfig = new WebuiPropertyMappingObject().getWebuiConfig();
			String provider = webConfig.getTransactionserviceprovider_server()+":"+webConfig.getTransactionserviceprovider_port();
			String factory = webConfig.getTransactionservicefactory();
			
			
			
			//			HC			return (TransactionServiceSORemote) EjbHelper.getSession("usdawvssawm2:6840", null, null,
			return (TransactionServiceSORemote) EjbHelper.getSession(provider, null, null,
					factory,"TransactionServiceSORemote", TransactionServiceSORemoteHome.class);
					*/
		} catch (Exception x) {
			x.printStackTrace();
			
			throw new SsaException("[getRemote]::Transaction service remote not accessible", x);
		}
	}
	
	public static void main(String []args){
		String provider = "192.168.205.153:11499";
		try {
			TransactionServiceSORemote remote = EJBRemote.getRemote(provider);
		} catch (SsaException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
}
